﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class MasterPage : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        loadControl();
        if (!IsPostBack)
        {
            //HttpCookie cookie = new HttpCookie("SelLang");
            if (Session["SelLang"].ToString() == "vi")
            {
                ImgBtn_Vn.Enabled = false;
                ImgBtn_En.Enabled = true;
            }
            else
            {
                ImgBtn_En.Enabled = false;
                ImgBtn_Vn.Enabled = true;
            }
        }
    }

    protected void loadControl()
    {
        if (Request.QueryString["pages"] != null)
        {
        }
        else
        {
            Control view = new Control();
            view = Page.LoadControl("UControl/uc_location.ascx");
            view.ID = "location";
            PH_Main.Controls.Clear();
            PH_Main.Controls.Add(view);
        }
    }

    protected void ImgBtn_Vn_Click(object sender, ImageClickEventArgs e)
    {
        //HttpCookie cookie = new HttpCookie("SelLang");
        Session["SelLang"] = "vi";
        //Response.SetCookie(cookie);
        ImgBtn_Vn.Enabled = true;
        ImgBtn_En.Enabled = false;
        Response.Redirect(Request.UrlReferrer.AbsoluteUri);
    }
    protected void ImgBtn_En_Click(object sender, ImageClickEventArgs e)
    {
        //HttpCookie cookie = new HttpCookie("SelLang");
        Session["SelLang"] = "en";
        //Response.SetCookie(cookie);
        ImgBtn_En.Enabled = true;
        ImgBtn_Vn.Enabled = false;
        Response.Redirect(Request.UrlReferrer.AbsoluteUri);
    }
}
